//
//  CLReadChapterListModel.m
//  CLBrowser
//
//  Created by 梁慧聪 on 2022/7/22.
//

#import "CLReadChapterListModel.h"
#import <objc/runtime.h>
#import <YYKit/YYClassInfo.h>
@implementation CLReadChapterListModel
@synthesize name = _name;


- (id)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder:aDecoder]) {
        _bookid = [aDecoder decodeObjectForKey:@"bookid"];
        _chapterid = [aDecoder decodeObjectForKey:@"chapterid"];
        _name = [aDecoder decodeObjectForKey:@"name"];
        _title = [aDecoder decodeObjectForKey:@"title"];
        _content = [aDecoder decodeObjectForKey:@"content"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder{
    
    if (_bookid) {
        [aCoder encodeObject:_bookid forKey:@"bookid"];
    }
    if (_chapterid) {
        [aCoder encodeObject:_chapterid forKey:@"chapterid"];
    }
    if (_name) {
        [aCoder encodeObject:_name forKey:@"_namename"];
    }
    if (_title) {
        [aCoder encodeObject:_title forKey:@"title"];
    }
    if (_content) {
        [aCoder encodeObject:_content forKey:@"content"];
    }
}

- (void)setName:(NSString *)name {
    _name = name;
    _title = name;
}

- (NSString *)name {
    return StrNilHolder(_name, _title);
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {}
@end
